import { useState } from "react";
import { TreeSelect } from "antd";
const treeData = [
    {
        title: "栏目一",
        value: "ceil-1",
        children: [
            {
                title: "栏目一-1",
                value: "ceil-1-1",
            },
            {
                title: "栏目一-2",
                value: "ceil-1-2",
            },
        ],
    },
    {
        title: "栏目二",
        value: "ceil-2",
        children: [
            {
                title: "栏目二-1",
                value: "ceil-2-1",
            },
            {
                title: "栏目二-2",
                value: "ceil-2-2",
            },
        ],
    },
];
const View = () => {
    const [value, setValue] = useState();
    const onChange = (newValue) => {
        console.log("onChange", newValue);
        setValue(newValue);
    };
    const onPopupScroll = (e) => {
        console.log("onPopupScroll", e);
    };
    return (
        <>
            <h1>树形选择器</h1>
            <TreeSelect
                value={value}
                treeData={treeData}
                onChange={onChange}
                onPopupScroll={onPopupScroll}
                treeDefaultExpandAll
                placeholder='请选择栏目'
                style={{ width: 300 }}
            />
        </>
    );
};

export default View;
